home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / DELPHI.SWG / 0021_How to use array of const.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  993 b   |  36 lines

  1. {
  2. Q:  How do I use "array of const"?
  3.  
  4. A: An array of const is in fact an open array of TVarRec (a
  5. predeclared Delphi type you can look up in the online help). So
  6. the following is Object Pascal psuedocode for the general battle
  7. plan:
  8. }
  9. procedure AddStuff( Const A: Array of Const );
  10. Var i: Integer;
  11. Begin
  12.   For i:= Low(A) to High(A) Do
  13.   With A[i] Do
  14.     Case VType of
  15.     vtExtended: Begin
  16.        { add real number, all real formats are converted to 
  17.          extended automatically }
  18.       End;
  19.     vtInteger: Begin
  20.  
  21.        { add integer number, all integer formats are converted 
  22.          to LongInt automatically }
  23.       End;
  24.     vtObject: Begin
  25.         If VObject Is DArray Then
  26.           With DArray( VObject ) Do Begin
  27.             { add array of doubles }
  28.           End
  29.         Else If VObject Is IArray Then
  30.           With IArray( VObject ) Do Begin
  31.             { add array of integers }
  32.           End;
  33.       End;
  34.     End; { Case }
  35. End; { AddStuff }
  36.